home *** CD-ROM | disk | FTP | other *** search
/ Aminet 40 / Aminet 40 (2000)(Schatztruhe)[!][Dec 2000].iso / Aminet / game / shoot / ADoomPPC_src.lha / ADoomPPC_src / d_net.h < prev    next >
Encoding:
C/C++ Source or Header  |  2000-09-28  |  3.3 KB  |  152 lines

  1. // Emacs style mode select   -*- C++ -*- 
  2. //-----------------------------------------------------------------------------
  3. //
  4. // $Id:$
  5. //
  6. // Copyright (C) 1993-1996 by id Software, Inc.
  7. //
  8. // This source is available for distribution and/or modification
  9. // only under the terms of the DOOM Source Code License as
  10. // published by id Software. All rights reserved.
  11. //
  12. // The source is distributed in the hope that it will be useful,
  13. // but WITHOUT ANY WARRANTY; without even the implied warranty of
  14. // FITNESS FOR A PARTICULAR PURPOSE. See the DOOM Source Code License
  15. // for more details.
  16. //
  17. // DESCRIPTION:
  18. //    Networking stuff.
  19. //
  20. //-----------------------------------------------------------------------------
  21.  
  22.  
  23. #ifndef __D_NET__
  24. #define __D_NET__
  25.  
  26. #include "d_player.h"
  27.  
  28.  
  29. #ifdef __GNUG__
  30. #pragma interface
  31. #endif
  32.  
  33.  
  34. //
  35. // Network play related stuff.
  36. // There is a data struct that stores network
  37. //  communication related stuff, and another
  38. //  one that defines the actual packets to
  39. //  be transmitted.
  40. //
  41.  
  42. #define DOOMCOM_ID        0x12345678l
  43.  
  44. // Max computers/players in a game.
  45. #define MAXNETNODES        8
  46.  
  47.  
  48. // Networking and tick handling related.
  49. #define BACKUPTICS        12
  50.  
  51. typedef enum
  52. {
  53.     CMD_SEND    = 1,
  54.     CMD_GET    = 2
  55.  
  56. }  command_t;
  57.  
  58. #ifdef __SASC
  59. #pragma options align=mac68k
  60. #endif
  61.  
  62. //
  63. // Network packet data.
  64. //
  65. typedef struct
  66. {
  67.     // High bit is retransmit request.
  68.     unsigned         checksum;
  69.     // Only valid if NCMD_RETRANSMIT.
  70.     byte         retransmitfrom;
  71.     
  72.     byte         starttic;
  73.     byte         player;
  74.     byte         numtics;
  75.     ticcmd_t         cmds[BACKUPTICS];
  76. }  doomdata_t;
  77.  
  78.  
  79. typedef struct
  80. {
  81.     // Supposed to be DOOMCOM_ID?
  82.     long         id;
  83.  
  84.     // DOOM executes an int to execute commands.
  85.     short         intnum;        
  86.     // Communication between DOOM and the driver.
  87.     // Is CMD_SEND or CMD_GET.
  88.     short         command;
  89.     // Is dest for send, set by get (-1 = no packet).
  90.     short         remotenode;
  91.     
  92.     // Number of bytes in doomdata to be sent
  93.     short         datalength;
  94.  
  95.     // Info common to all nodes.
  96.     // Console is allways node 0.
  97.     short         numnodes;
  98.     // Flag: 1 = no duplication, 2-5 = dup for slow nets.
  99.     short         ticdup;
  100.     // Flag: 1 = send a backup tic in every packet.
  101.     short         extratics;
  102.     // Flag: 1 = deathmatch.
  103.     short         deathmatch;
  104.     // Flag: -1 = new game, 0-5 = load savegame
  105.     short         savegame;
  106.     short         episode;    // 1-3
  107.     short         map;        // 1-9
  108.     short         skill;        // 1-5
  109.  
  110.     // Info specific to this node.
  111.     short         consoleplayer;
  112.     short         numplayers;
  113.     
  114.     // These are related to the 3-display mode,
  115.     //  in which two drones looking left and right
  116.     //  were used to render two additional views
  117.     //  on two additional computers.
  118.     // Probably not operational anymore.
  119.     // 1 = left, 0 = center, -1 = right
  120.     short         angleoffset;
  121.     // 1 = drone
  122.     short         drone;        
  123.  
  124.     // The packet data to be sent.
  125.     doomdata_t         data;
  126. }  doomcom_t;
  127.  
  128. #ifdef __SASC
  129. #pragma options align=power
  130. #endif
  131.  
  132.  
  133. // Create any new ticcmds and broadcast to other players.
  134. void NetUpdate (void);
  135.  
  136. // Broadcasts special packets to other players
  137. //  to notify of game exit
  138. void D_QuitNetGame (void);
  139.  
  140. //? how many ticks to run?
  141. void TryRunTics (void);
  142.  
  143.  
  144. #endif
  145.  
  146. //-----------------------------------------------------------------------------
  147. //
  148. // $Log:$
  149. //
  150. //-----------------------------------------------------------------------------
  151.  
  152.